import axios from '@/libs/request/axios'
// 获取普通车商数据 多条件
export const getCarDealerData = (params) => {
    return axios.request({
        url: '/channel/carDealer/getByCondition',
        data:params,
        method: 'post'
    })
}

export const getAllCardealerName = (params) => {
    return axios.request({
        url: '/channel/carDealer/getAllCardealerName',
        data:params,
        method: 'post'
    })
}

// 通过普通车商id查询基本信息
export const getCarDealerInfoById = (id,params) => {
    return axios.request({
        url: `/channel/carDealer/getcommonCarDealerInfoById/${id}`,
        params:params,
        method: 'get'
    })
}

// 获取直营车商数据 多条件
export const getDirectCarDealerData = (params) => {
    return axios.request({
        url: '/channel/carDealer/getDirectCarDealerListByCondition',
        data:params,
        method: 'post'
    })
}
// 根据普通车商id获取对应的渠道信息
export const getChannelInfoData = (id, params) => {
    return axios.request({
        url:`/channel/carDealer/getChannelsByCardealerId/${id}`,
        params:params,
        method: 'get'
    })
}

// 添加普通车商
export const saveCarDealerData = (params) => {
    return axios.request({
        url: '/channel/carDealer/addCarDealer',
        data:params,
        method: 'post'
    })
}

//编辑普通车商
export const editCarDealerData = (params) => {
    return axios.request({
        url: '/channel/carDealer/editCarDealerFromChannel',
        data:params,
        method: 'post'
    })
}

//禁用普通车商
export const disableCarDealer = (ids, params) => {
    return axios.request({
        url:`/channel/carDealer/disableCarDealer/${ids}`,
        params:params,
        method: 'get'
    })
}

//禁用案件服务中普通车商
export const disableCarDealerFromCase = (ids, params) => {
    return axios.request({
        url:`/channel/common/disableCarDealerFromCase/${ids}`,
        params:params,
        method: 'get'
    })
}

//禁用直营车商
export const disableDirectCarDealer = (ids, params) => {
    return axios.request({
        url:`/channel/carDealer/disableDirectCarDealer/${ids}`,
        params:params,
        method: 'get'
    })
}

//禁用案件服务中直营车商
export const disableDirectCarDealerFromCase = (ids, params) => {
    return axios.request({
        url:`/channel/common/disableDirectCarDealerFromCase/${ids}`,
        params:params,
        method: 'get'
    })
}

// 删除车商
export const deleteCardealer = (channelId,id, params) => {
    return axios.request({
        url:`/channel/carDealer/delByIds/${channelId}/${id}`,
        params:params,
        method: 'delete'
    })
}
// 删除普通车商
export const deleteCommonCardealerById = (id, params) => {
    return axios.request({
        url:`/channel/carDealer/deleteCommonCardealerById/${id}`,
        params:params,
        method: 'delete'
    })
}

// 保存直营车商基本信息
export const addChannel = (params) => {
    return axios.request({
        url: '/channel/carDealer/saveDirectCarDealer',
        data:params,
        method: 'post'
    })
}

// 暂存直营车商基本信息
export const stagingSaveDirectCarDealer = (params) => {
    return axios.request({
        url: '/channel/carDealer/stagingSaveDirectCarDealer',
        data:params,
        method: 'post'
    })
}

// 更新直营车商信息
export const updateChannel = (params) => {
    return axios.request({
        url: '/channel/carDealer/updateDirectCarDealer',
        data:params,
        method: 'post'
    })
}

    //保存开票信息
export const savaInvoiceInfo = (params) => {
    return axios.request({
        url: '/channel/carDealer/savaInvoiceInfo',
        data: params,
        method: 'post'
    })
}

/**
 *新增黑名单
 * @param obj
 * @returns {*}
 */
export function saveBlack(obj) {
    return axios.request({
        url: '/channel/black/save',
        method: 'POST',
        data: obj
    })
}

/**
 *验证是否在黑名单信息库中
 * @param obj
 * @returns {*}
 */
export function blackCleack(obj) {
    return axios.request({
        url: '/channel/black/checkBlack',
        method: 'POST',
        data: obj
    })
}

//批量修改业务员
export const bulkEditingSalesman = (salesman,ids, params) => {
    return axios.request({
        url:`/channel/carDealer/bulkEditingSalesman/${salesman}/${ids}`,
        params:params,
        method: 'get'
    })
}

//批量修改案件服务中普通车商业务员
export const bulkEditingSalesmanFromCase = (salesman,ids, params) => {
    return axios.request({
        url:`/channel/common/bulkEditingSalesmanFromCase/${salesman}/${ids}`,
        params:params,
        method: 'get'
    })
}

//获取全部的直营车商城市经理
export const findAllCustomerManager = (params) => {
    return axios.request({
        url:`/channel/carDealer/findAllCustomerManager`,
        params:params,
        method: 'get'
    })
}

//批量修改直营车商城市经理
/*export const bulkEditingCustomerManager = (customerManager,channelIds,ids,type, params) => {
    return axios.request({
        url:`/channel/carDealer/bulkEditingCustomerManager/${customerManager}/${channelIds}/${ids}/${type}`,
        params:params,
        method: 'get'
    })
}*/

export const bulkEditingCustomerManager = (params) => {
    return axios.request({
        url: '/channel/carDealer/bulkEditingCustomerManager',
        data: params,
        method: 'post'
    })
}

//批量修改案件服务中的直营车商城市经理
export const bulkEditingCustomerManagerFromCase = (customerManager,channelIds,ids,type, params) => {
    return axios.request({
        url:`/channel/common/bulkEditingCustomerManagerFromCase/${customerManager}/${channelIds}/${ids}/${type}`,
        params:params,
        method: 'get'
    })
}

//获取全部的sp和总对总合作商
export const getAllSPChannels = (params) => {
    return axios.request({
        url:`/channel/carDealer/getAllSPChannels`,
        params:params,
        method: 'get'
    })
}

//获取全部的直营合作商
export const getAllDirectChannels = (params) => {
    return axios.request({
        url:`/channel/carDealer/getAllDirectChannels`,
        params:params,
        method: 'get'
    })
}

//保存普通车商到案件
export const saveCarDealerDataToCase = (params) => {
    return axios.request({
        url: '/channel/common/addCommonCarDealer',
        data:params,
        method: 'post'
    })
}

//更新普通车商状态
export const updateCommonCarDealerStatus = (params) => {
    return axios.request({
        url: '/channel/carDealer/updateCommonCarDealerStatus',
        data:params,
        method: 'post'
    })
}

//保存直营车商到案件
export const saveDirectCarDealerDataToCase = (params) => {
    return axios.request({
        url: '/channel/common/saveDirectCarDealer',
        data:params,
        method: 'post'
    })
}

//保存开票信息
export const savaInvoiceInfoToCase = (params) => {
    return axios.request({
        url: '/channel/common/savaInvoiceInfo',
        data: params,
        method: 'post'
    })
}

/**
 *新增收款账号信息
 * @param params
 * @returns {*}
 */
export function saveAccountInfo(params) {
    return axios.request({
        url: '/channel/carDealer/saveAccountInfo',
        method: 'POST',
        data: params
    })
}

/**
 * 修改收款账号信息
 * @param params
 * @returns {*}
 */
export function updateAccountInfo(params) {
    return axios.request({
        url: '/channel/carDealer/updateAccountInfo',
        method: 'POST',
        data: params
    })
}

/**
 * 根据车商代码查询合作车商信息
 * @param params
 * @author tiankai
 */
export const getCarDealerListByCode = (params) => {
    return axios.request({
        url: '/channel/carDealer/getCarDealerListByCode',
        data:params,
        method: 'post'
    })
}

// 获取直营车商展区区域信息
export const getDirectCardealerAreaListData = (params) => {
    return axios.request({
        url: '/channel/carDealer/getAreaListCondition',
        data: params,
        method: 'post'
    })
}

//根据直营车商id获取收款账号信息
export const getAccountInfoByChannelId = (channelId,params) => {
    return axios.request({
        url:`/channel/carDealer/getAccountInfoByChannelId/${channelId}`,
        params:params,
        method: 'get'
    })
}

//改车商收款账号状态
export const changeAccountStatus = (channelId,params) => {
    return axios.request({
        url:`/channel/carDealer/changeAccountStatus/${channelId}`,
        params:params,
        method: 'get'
    })
}

//根据渠道id获取所有的业务员
export const getAllSaleManByChannelId = (channelId,businessType,params) => {
    return axios.request({
        url:`/channel/carDealer/getAllSaleManByChannelId/${channelId}/${businessType}`,
        params:params,
        method: 'get'
    })
}

//根据用户名获取用户真名
export const getSalemanNameByUsername = (username,params) => {
    return axios.request({
        url:`/channel/carDealer/getSalemanNameByUsername/${username}`,
        params:params,
        method: 'get'
    })
}

//验证直营车商跟合作商之间的合作关系
export const checkCooper = (params) => {
    return axios.request({
        url: '/channel/carDealer/checkCooper',
        data:params,
        method: 'post'
    })
}

//获取备案信息合作车商
export const getCarDealersByChannelId = (params) => {
    return axios.request({
        url: '/channel/carDealer/getCarDealersByChannelId',
        data: params,
        method: 'post'
    })
}

//根据渠道id获取授权
export const getAreaByChannelId = (channelId,businessType,params) => {
    return axios.request({
        url:`/channel/carDealer/getAreaByChannelId/${channelId}/${businessType}`,
        params:params,
        method: 'get'
    })
}

//查普通车商是否在库
export const getCommonCarDealerInDepotInfo = (socUniCrtCode,params) => {
    return axios.request({
        url:`/channel/carDealer/getCommonCarDealerInDepotInfo/${socUniCrtCode}`,
        params:params,
        method: 'get'
    })
}

//禁用或启用普通车商
export const disableCarDealerRelation = (ids,channelId,status,params) => {
    return axios.request({
        url:`/channel/carDealer/disableCarDealerFromApply/${ids}/${channelId}/${status}`,
        params:params,
        method: 'get'
    })
}

//禁用或启用直营车商
export const disableDirectCarDealerRelation = (ids,channelId,status,params) => {
    return axios.request({
        url:`/channel/carDealer/disableDirectCarDealerFromApply/${ids}/${channelId}/${status}`,
        params:params,
        method: 'get'
    })
}






